package com.qut.system_1.controller;

import com.qut.system_1.mapper.medicineMapper;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/medicine")
public class medicineController {
    @Resource
    private medicineMapper Map;
    @RequestMapping("/reg")
    public int reg(@RequestParam Map<String,String> param){
        int row=0;
        System.out.println(param);
        //调用接口中的方法
        row=Map.save(param);
        return row;
    }

    @RequestMapping("/search")
    public List<Map<String,Object>> search(@RequestParam Map<String,String> param){
        List<Map<String,Object>> list=null;
        list=Map.search(param);
        return list;
    }

    @RequestMapping("/delete")
    public int delete(String[] ids){
        int row=0;
        row=Map.delete(ids);
        return row;
    }

    @RequestMapping("/edit")
    public int edit(@RequestParam Map<String,String> param){
        int row=0;
        row=Map.update(param);
        return row;
    }

}